<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>对象拓展运算符</title>
</head>
<body>
<p>拓展运算符（...）用于取出参数对象所有可遍历属性然后拷贝到当前属性</p>
<script>
    let user = {name: "憨憨", age: 18};

    //对象复制
    let hh = {...user};
    console.log(hh);

    //对象的属性合并
    let hobby = "boy";
    let hh1 = {...user, hobby};
    console.log(hh1);

    let hh2={...hh1,address:"河南濮阳"};
    console.log(hh2);

    //...  可以和解构数组组合属性
    let arr = [1, 2, 3, 4, 5, 6];
    let [x, y, ...z] = arr; //x=1  y=2  z=[3,4,5,6]
    console.log(x, y, z);
</script>
</body>
</html>